﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace JustPlus
{
    /// <summary>
    /// LogoutPanel.xaml 的交互逻辑
    /// </summary>
    public partial class LogoutPanel : UserControl
    {
        public LogoutPanel()
        {
            InitializeComponent();
        }

        private void Grid_MouseLeave(object sender, MouseEventArgs e)
        {
            if (LoginPanel.HasLoginOn)
            {
                MainWindow mwnd = (MainWindow)Application.Current.MainWindow;
                mwnd.stackPanel1.Children.Clear();
                mwnd.stackPanel1.Children.Add(mwnd.stackPanel2);
                mwnd.stackPanel1.Children.Add(mwnd.stackPanel3);
            } 
        }

        //注销登录
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            //string temp = new ConnectionBase().Get(OperationPanel.logoutUrl);
            ConnectionBase.cc = new System.Net.CookieContainer(1000, 1000, 100000);
            //ConnectionBase.cc = ConnectionBase.DefaultCookie;
            LoginPanel.HasLoginOn = false;
            MainWindow mwnd = (MainWindow)Application.Current.MainWindow;
            mwnd.stackPanel1.Children.Clear();
            LoginPanel loginpanel = new LoginPanel();
            mwnd.stackPanel1.Children.Add(loginpanel);
        }
    }
}
